﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter14.Code01.Code02.Example01
{
    public class Demo
    {
        public static void Begin()
        {
            {
                Farm<Animal> farm = new Farm<Animal>
                {
                    new Cow { Name="Norris" },
                    new Chicken { Name="Rita" },
                    new Chicken(),
                    new SuperCow { Name="Chesney" }
                };
                farm.MakeNoises();
                Console.ReadLine();
            }
            {
                Farm<Animal> farm = new Farm<Animal>
                {
                    Animals =
                    {
                        new Cow{Name="Norris"},
                        new Chicken{Name="Rita"},
                        new Chicken(),
                        new SuperCow{Name="Chesney"}
                    }
                };
                farm.MakeNoises();
                Console.ReadLine();
            }
        }
    }
}
